package gkiil.draw;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.View;

public class MyPath extends View {

	ArrayList<Dot> dot; 
	Paint paint;
	public MyPath(Context context) {
		super(context);
		dot = new ArrayList<Dot>();
		paint = new Paint();
		paint.setColor(Color.CYAN);
		paint.setStrokeWidth(10);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void onDraw(Canvas canvas) {
		// TODO Auto-generated method stub
		for(int i=0;i<dot.size();i++){
			canvas.drawPoint(dot.get(i).getX(), dot.get(i).getY(), paint);
		}
		super.onDraw(canvas);
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		// TODO Auto-generated method stub
		dot.add(new Dot(event.getX(),event.getY()));
		return super.onTouchEvent(event);
		
	}
	
	

}
